﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CardID
{
    static class ServiceClient
    {
        public static localhost.PayServiceService service = new localhost.PayServiceService();

        /*
        public static void setService()
        {
            service = new localhost.PayServiceService();
            service.CookieContainer = new System.Net.CookieContainer();
        }*/
              
        // request service
        public static localhost.MakePaymentResponse sendRequest()
        {
            service.CookieContainer = new System.Net.CookieContainer();
            localhost.MakePaymentRequest request =  new localhost.MakePaymentRequest();
            localhost.MakePaymentResponse response = null;
            request.actionType = "CREATE";
            response = service.makePayment(request);
            return response;
        }
        public static localhost.ExecutePaymentResponse excuteRequest(string tokenID,int userID,float amount)
        {
            localhost.ExecutePaymentRequest request = new localhost.ExecutePaymentRequest();
            localhost.ExecutePaymentResponse response = null;
            request.actionType = "EXECUTE";
            request.fromUserID = userID;
            request.toUserID = 3;
            request.amount = amount;
            request.tokenID = tokenID;
            response = service.executePayment(request);
            return response;
        }
        public static localhost.AuthenPaymentResponse authenRequest(int timestamp, string tokenID, int transactionID, string activeCode)
        {
            localhost.AuthenPaymentRequest request = new localhost.AuthenPaymentRequest();
            localhost.AuthenPaymentResponse response = null;
            request.timestamp = timestamp;
            request.tokenID = tokenID;
            request.transactionID = transactionID;
            request.activationCode = activeCode;
            request.actionType = "FINISH";
            response = service.authenPayment(request);
            return response;
        }
        public static localhost.RechargePaymentResponse rechargeRequest(string tokenID, int userID, int timestamp)
        {
            localhost.RechargePaymentRequest request = new localhost.RechargePaymentRequest();
            localhost.RechargePaymentResponse response = null;
            request.actionType = "RECHARGE";
            request.userID = userID;
            request.tokenID = tokenID;
            request.timestamp = timestamp;
            response = service.rechargePayment(request);
            return response;
        }
        public static localhost.FinishPaymentResponse finishRequest(string activeCode, int transacID)
        {
            localhost.FinishPaymentRequest request = new localhost.FinishPaymentRequest();
            localhost.FinishPaymentResponse response = null;
            request.actionType = "FINISH";
            request.activationCode = activeCode;
            request.transactionID = transacID;
           // request.timestamp = timestamp;
            response = service.finishPayment(request);
            return response;
        }
        public static localhost.TransferPaymentResponse transferRequest(int timestamp, string tokenID)
        {
            localhost.TransferPaymentRequest request = new localhost.TransferPaymentRequest();
            localhost.TransferPaymentResponse response = null;
            request.actionType = "TRANSFER";
            request.timestamp = timestamp;
            request.tokenID = tokenID;
            response = service.transferPayment(request);
            return response;
        }
    }
}
